#include "cocos2d.h"
#include "cocos-ext.h"
#include "TreeComponent.h"

USING_NS_CC;
USING_NS_CC_EXT;

TreeComponent::TreeComponent()
{
	setName("TreeComponent");
	mIsDell = 0;
	
}

void TreeComponent::update(float delta)
{
	
	if(mIsDell == 1)
	{
		return;
	}
	mSprite = (CCSprite *)getOwner();
	if(mSprite==NULL)
	{
		return;
	}
	if(mSprite->getParent()->convertToWorldSpace(mSprite->getPosition()).y > 480 + mSprite->getContentSize().height/2)
	{
		mSprite->removeComponent("TreeComponent");
		mSprite->getParent()->removeChild(mSprite);
		mIsDell = 0;
	}
}